<?php

/**
 * Favoris form base class.
 *
 * @method Favoris getObject() Returns the current form's model object
 *
 * @package    explications_informatiques
 * @subpackage form
 * @author     Guimezanes Cyrille
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseFavorisForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'idfavoris'  => new sfWidgetFormInputHidden(),
      'id_client'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('SfGuardUserProfile'), 'add_empty' => true)),
      'id_asso'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Assoplatform'), 'add_empty' => false)),
      'id_article' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Articles'), 'add_empty' => false)),
    ));

    $this->setValidators(array(
      'idfavoris'  => new sfValidatorChoice(array('choices' => array($this->getObject()->get('idfavoris')), 'empty_value' => $this->getObject()->get('idfavoris'), 'required' => false)),
      'id_client'  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('SfGuardUserProfile'), 'required' => false)),
      'id_asso'    => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Assoplatform'))),
      'id_article' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Articles'))),
    ));

    $this->widgetSchema->setNameFormat('favoris[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Favoris';
  }

}
